package org.system.core.service.monitor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.system.core.domain.entity.SysOperLog;
import org.system.core.exception.ServiceException;
import org.system.core.mapper.monitor.SysOperLogMapper;
import org.system.core.utils.MessageUtils;

import java.util.List;

/**
 * @author baoRoot
 */
@Service
public class SysOperLogService {

    @Autowired
    private SysOperLogMapper operLogMapper;

    public void insertOperlog(SysOperLog operLog) {
        operLogMapper.insertOperlog(operLog);
    }

    public List<SysOperLog> selectOperLogList(SysOperLog operLog) {
        return operLogMapper.selectOperLogList(operLog);
    }

    public void deleteOperLogByIds(Long[] operIds) {
        if (operLogMapper.deleteOperLogByIds(operIds) <= 0) {
            throw new ServiceException(MessageUtils.message("system.monitor.delete_error"));
        }
    }

    public SysOperLog selectOperLogById(Long operId) {
        return operLogMapper.selectOperLogById(operId);
    }

    public void cleanOperLog() {
        operLogMapper.cleanOperLog();
    }

}
